

<div class="pageContent">
    <form method="post" action="__CONTROLLER__/addTasks" id="tasks">
        <input type="hidden" name="kpi_id" value="<{$kpi_id}>"/>
        <table class="table" width="100%" layoutH="50">
            <thead>
                <tr>               
                    <th width="40"  align="center">序号</th>
                    <th width="80" >任务</th>
                    <th width="70" align="center">计划完成日期</th>
                    <th width="70" align="center">实际完成日期</th>
                    <th width="240" >任务描述</th>
                    <th width="40" align="center" >权重</th>
                </tr>
            </thead>        
            <tbody>
                <tr>
                    <input name="id0" value="<{$list[0]['id']}>" type="hidden"/>    
                    <td>1</td>
                    <td><input type="text" name='subjects0' value="<{$list[0]['subjects']}>" style="width:180px"/></td>
                    <td><input type="text" name='completion_data0' value="<{$list[0]['completion_data']}>" readonly='true' class='date'/></td>
                    <td><input type="text" name='actual_completion_data0' value="<{$list[0]['actual_completion_data']}>" readonly='true' class='date'/></td>               
                    <td class="imgs"><textarea name="modification_record0" cols="60" rows="1" style="resize:none"><{$list[0]['modification_record']}></textarea></td>
                    <td><input class="percentage" type="text" name='percentage0' value="<{$list[0]['percentage']}>" style="width:80px"/></td>
                </tr>
                <tr>
                    <input name="id1" value="<{$list[1]['id']}>" type="hidden"/>    
                    <td>2</td>
                    <td><input type="text" name='subjects1' value="<{$list[1]['subjects']}>" style="width:180px"/></td>
                    <td><input type="text" name='completion_data1' value="<{$list[1]['completion_data']}>" readonly='true' class='date'/></td>
                    <td><input type="text" name='actual_completion_data1' value="<{$list[1]['actual_completion_data']}>" readonly='true' class='date'/></td>
                    <td class="imgs"><textarea name="modification_record1" cols="60" rows="1" style="resize:none"><{$list[1]['modification_record']}></textarea></td>
                    <td><input class="percentage" type="text" name='percentage1' value="<{$list[1]['percentage']}>" style="width:80px"/></td>
                </tr>
                <tr>
                    <input name="id2" value="<{$list[2]['id']}>" type="hidden"/>    
                    <td>3</td>
                    <td><input type="text" name='subjects2' value="<{$list[2]['subjects']}>" style="width:180px"/></td>
                    <td><input type="text" name='completion_data2' value="<{$list[2]['completion_data']}>" readonly='true' class='date'/></td>
                    <td><input type="text" name='actual_completion_data2' value="<{$list[2]['actual_completion_data']}>" readonly='true' class='date'/></td>
                    <td class="imgs"><textarea name="modification_record2" cols="60" rows="1" style="resize:none"><{$list[2]['modification_record']}></textarea></td>
                    <td><input class="percentage" type="text" name='percentage2' value="<{$list[2]['percentage']}>" style="width:80px"/></td>
                </tr>
                <tr>
                    <input name="id3" value="<{$list[3]['id']}>" type="hidden"/>    
                    <td>4</td>
                    <td><input type="text" name='subjects3' value="<{$list[3]['subjects']}>" style="width:180px"/></td>
                    <td><input type="text" name='completion_data3' value="<{$list[3]['completion_data']}>" readonly='true' class='date'/></td>
                    <td><input type="text" name='actual_completion_data3' value="<{$list[3]['actual_completion_data']}>" readonly='true' class='date'/></td>
                    <td class="imgs"><textarea name="modification_record3" cols="60" rows="1" style="resize:none"><{$list[3]['modification_record']}></textarea></td>
                    <td><input class="percentage" type="text" name='percentage3' value="<{$list[3]['percentage']}>" style="width:80px"/></td>
                </tr>
                <tr>
                    <input name="id4" value="<{$list[4]['id']}>" type="hidden"/>    
                    <td>5</td>
                    <td><input type="text" name='subjects4' value="<{$list[4]['subjects']}>" style="width:180px"/></td>
                    <td><input type="text" name='completion_data4' value="<{$list[4]['completion_data']}>" readonly='true' class='date'/></td>
                    <td><input type="text" name='actual_completion_data4' value="<{$list[4]['actual_completion_data']}>" readonly='true' class='date'/></td>
                    <td class="imgs"><textarea name="modification_record4" cols="60" rows="1" style="resize:none"><{$list[4]['modification_record']}></textarea></td>
                    <td><input class="percentage" type="text" name='percentage4' value="<{$list[4]['percentage']}>" style="width:80px"/></td>
                </tr>
                <tr>
                    <input name="id5" value="<{$list[5]['id']}>" type="hidden"/>    
                    <td>6</td>
                    <td><input type="text" name='subjects5' value="<{$list[5]['subjects']}>" style="width:180px"/></td>
                    <td><input type="text" name='completion_data5' value="<{$list[5]['completion_data']}>" readonly='true' class='date'/></td>
                    <td><input type="text" name='actual_completion_data5' value="<{$list[5]['actual_completion_data']}>" readonly='true' class='date'/></td>
                    <td class="imgs"><textarea name="modification_record5" cols="60" rows="1" style="resize:none"><{$list[5]['modification_record']}></textarea></td>
                    <td><input class="percentage" type="text" name='percentage5' value="<{$list[5]['percentage']}>" style="width:80px"/></td>
                </tr>
                <tr>
                    <input name="id6" value="<{$list[6]['id']}>" type="hidden"/>    
                    <td>7</td>
                    <td><input type="text" name='subjects6' value="<{$list[6]['subjects']}>" style="width:180px"/></td>
                    <td><input type="text" name='completion_data6' value="<{$list[6]['completion_data']}>" readonly='true' class='date'/></td>
                    <td><input type="text" name='actual_completion_data6' value="<{$list[6]['actual_completion_data']}>" readonly='true' class='date'/></td>
                    <td class="imgs"><textarea name="modification_record6" cols="60" rows="1" style="resize:none"><{$list[6]['modification_record']}></textarea></td>
                    <td><input class="percentage" type="text" name='percentage6' value="<{$list[6]['percentage']}>" style="width:80px"/></td>
                </tr>
                <tr>
                    <input name="id7" value="<{$list[7]['id']}>" type="hidden"/>    
                    <td>8</td>
                    <td><input type="text" name='subjects7' value="<{$list[7]['subjects']}>" style="width:180px"/></td>
                    <td><input type="text" name='completion_data7' value="<{$list[7]['completion_data']}>" readonly='true' class='date'/></td>
                    <td><input type="text" name='actual_completion_data7' value="<{$list[7]['actual_completion_data']}>" readonly='true' class='date'/></td>
                    <td class="imgs"><textarea name="modification_record7" cols="60" rows="1" style="resize:none"><{$list[7]['modification_record']}></textarea></td>
                    <td><input class="percentage" type="text" name='percentage7' value="<{$list[7]['percentage']}>" style="width:80px"/></td>
                </tr>
                <tr>
                    <input name="id8" value="<{$list[8]['id']}>" type="hidden"/>    
                    <td>9</td>
                    <td><input type="text" name='subjects8' value="<{$list[8]['subjects']}>" style="width:180px"/></td>
                    <td><input type="text" name='completion_data8' value="<{$list[8]['completion_data']}>" readonly='true' class='date'/></td>
                    <td><input type="text" name='actual_completion_data8' value="<{$list[8]['actual_completion_data']}>" readonly='true' class='date'/></td>
                    <td class="imgs"><textarea name="modification_record8" cols="60" rows="1" style="resize:none"><{$list[8]['modification_record']}></textarea></td>
                    <td><input class="percentage" type="text" name='percentage8' value="<{$list[8]['percentage']}>" style="width:80px"/></td>
                </tr>
                <tr>
                    <input name="id9" value="<{$list[9]['id']}>" type="hidden"/>    
                    <td>10</td>
                    <td><input type="text" name='subjects9' value="<{$list[9]['subjects']}>" style="width:180px"/></td>
                    <td><input type="text" name='completion_data9' value="<{$list[9]['completion_data']}>" readonly='true' class='date'/></td>
                    <td><input type="text" name='actual_completion_data9' value="<{$list[9]['actual_completion_data']}>" readonly='true' class='date'/></td>
                    <td class="imgs"><textarea name="modification_record9" cols="60" rows="1" style="resize:none"><{$list[9]['modification_record']}></textarea></td>
                    <td><input class="percentage" type="text" name='percentage9' value="<{$list[9]['percentage']}>" style="width:80px"/></td>
                </tr>
            </tbody>        
        </table>
    </form>
</div>
<div class="buttonActive"><div class="buttonContent"><button type="submit" id="yes_tasks">确认</button></div></div>
<style type="text/css" media="screen">
    .imgs div{height:40px!important;}
</style>
<script>
    $(function(){
        $("#yes_tasks").click(function(){           
            var count    =new Array();
            for(i=0;i<$(".percentage").length;i++){
                if($("input[name='percentage"+i+"']").val()){
                    count[i]=parseInt($("input[name='percentage"+i+"']").val());
                }
            }
            if(eval(count.join('+'))!=100){
                alert("权重相加必须为100%");
                return false;
            }
            $.ajax({
                url:'__CONTROLLER__/addTasks',
                type:"POST",
                data:$('#tasks').serialize(),
                success: function(data) {
                    if(data){
                        alert("任务编辑成功");
                    }
                }
            });
       }); 
    });
</script>
